package com.shanghai.shanghaielectric.UI.chart.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.shanghai.shanghaielectric.R;

/**
 * Created by ICE on 2018/1/3.
 */

public class LegendView extends View {

    private View mView;

    private TextView nameView;
    public LegendView(Context context) {
        super(context);

        LayoutInflater mInflater = LayoutInflater.from(context);
        View myView = mInflater.inflate(R.layout.data_chart_view_item, null);
       mView=myView.findViewById(R.id.chart_view_item_color);
       nameView=myView.findViewById(R.id.chart_view_item_name);

    }

    public void setName(String name){
        nameView.setText(name);
    }

    @SuppressLint("ResourceType")
    public void setColor(int color){

        mView.setBackgroundColor(color);
    }
}
